package com.xzp.bams.entity;

/**
 * @TODO 银行的客户分为两大类：储蓄账户(SavingAccount)和信用账户(CreditAccount),两种的账户类型的区别在于：
 * 储蓄账户不允许透支, 而信用账户可以透支, 并在用户在满足银行条件的情况下允许用户调整自己的透支额度.
 * @Author xu
 * 2025/3/7
 */
public class SavingAccount extends Account{
    public SavingAccount() {
    }

    public SavingAccount(Long id, String password, String name, String personId, String email, double balance) {
        super(id, password, name, personId, email, balance);
    }

    @Override
    public Account withdraw(double money){
        if (this.getBalance() < money) {
            System.out.println("余额不足");
            return this;
        } else {
            this.setBalance(this.getBalance() - money);
            return this;
        }
    }
}
